package yur.wedding.common.utils;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 读取配置文件中的图片路径
 *
 * @Author: Yur
 * @Data:2022/5/8 9:42
 */

@Configuration
public class MyWebMvcConfiguration implements WebMvcConfigurer {

    //配置本地文件映射到url上
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //重写方法
        //修改tomcat 虚拟映射
        registry.addResourceHandler("/static/**")
                .addResourceLocations("file:" + Constant.UPLOADPATHIMG);//定义图片存放路径
    }
}


